package model.interactionHandlerInitializer;

import java.awt.Dimension;

import main.Log;
import model.entity.Talkable;
import model.interactionhandler.InteractionContainer;
import view.OverlayIds;
import view.TalkOverlay;
import controller.GameConfig;
import controller.TalkController;


public class TalkHandlerInitializer extends InteractionHandlerInitializer{
	public TalkHandlerInitializer(String theName) {
		super(theName);
	}

	public void handle(){
		Log.out( Log.CONTROLLER, "{DEBUG} in talk handler initializer");
		Talkable npc; 
		try{
			npc = (Talkable) InteractionContainer.getInstance().getTarget();
		} catch( Exception e ) {
			Log.out( Log.CONTROLLER, "{ERROR} expected a talkable and did not get a talkable");
			return ;
		}
		TalkOverlay to = new TalkOverlay( new Dimension(800,600), npc);
		TalkController tc = new TalkController(GameConfig.GAME_WINDOW, to, InteractionContainer.getInstance());
		GameConfig.GAME_WINDOW.addOverlay( OverlayIds.TALK, to );
	};
}